package com.lhh.wiki.controller;
import com.lhh.wiki.domain.EbookSaveReq;
import com.lhh.wiki.req.EbookQueryReq;
import com.lhh.wiki.resp.CommonResp;
import com.lhh.wiki.resp.EbookQueryResp;
import com.lhh.wiki.resp.PageResp;
import com.lhh.wiki.service.EbookService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ebook")
public class EbookController {

    @Resource
    private EbookService ebookService;
    @GetMapping("/list")
    public CommonResp list(EbookQueryReq req){
        CommonResp<PageResp<EbookQueryResp>> resp =new CommonResp<>();
        PageResp<EbookQueryResp> list =ebookService.list(req);
        resp.setContent(list);
        return resp;
    }
    @PostMapping("/save")
    public CommonResp save(@RequestBody EbookSaveReq req){
        CommonResp resp =new CommonResp<>();
        ebookService.save(req);
        return resp;
    }
}
